<template>
	<div class="votemain">
		<h2>支持人数：{{supNum}}</h2>
		<h2>反对人数：{{oppNum}}</h2>
		<h2>支持率：{{result}}</h2>
	</div>
</template>

<script>
	export default {
		name:"Votemain",
		data(){
			return{
				
			}
		},
		props:{
			supNum:{
				type:Number,
				required:true,
				default:0
			},
			oppNum:{
				type:Number,
				required:true,
				default:0
			}
		},
		computed:{
			result(){
				let total=this.supNum+this.oppNum;
				if(total<=0){
					return "0.00%";
				}
				return (this.supNum/total*100).toFixed(2)+"%"
			}
		}
	}
</script>

<style>
</style>
